package jndi;

import java.sql.Connection;

import javax.naming.InitialContext;

import org.apache.tomcat.jdbc.pool.DataSource;

public class Jndi {
	
	public static Connection getConnection(){
		Connection con=null;
		try {
			InitialContext cxt = new InitialContext();
			DataSource ds = (DataSource) cxt.lookup( "java:/comp/env/jdbc/myoracle" );
			con=ds.getConnection();
			System.out.println(con);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return con;
	}
	

}
